﻿using System;
using System.Collections.Generic;
using System.Linq;

namespace VSIXUtilities.DataObjects
{
    public class LanguageSpecificationsRepository : List<LanguageSpecifications>
    {
        public LanguageSpecifications Add(string Extension, string DocumentationNotation, string EmptyDocumentationString)
        {
            LanguageSpecifications LanguageSpecificationsInstance = new LanguageSpecifications(Extension, DocumentationNotation, EmptyDocumentationString);
            Add(LanguageSpecificationsInstance);
            return LanguageSpecificationsInstance;
        }
        
        public LanguageSpecifications this[string Extension]
        {
            get
            {
                return this.SingleOrDefault(LS => LS.Extension == Extension);
            }
        }
        
        public bool IsSupported(string Extension)
        {
            return this[Extension] != null;
        }
    }
}
